// TOWN DIALOGUE SCRIPT
//    Town 171: Moon

begintalkscript;

variables;

short i,j,k,r1,choice;

// Cerulian

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Cerulian";
	text1 = "You meet Moon's librarian. She rises to greet you, nodding and shaking your hand in a businesslike way. _I am Cerulian. Librarian. Welcome._";
	text2 = "Her speech is terse. She constantly looks to the door, as if she expects monsters to charge through at any moment.";
	text5 = "You try to talk to Cerulian, Moon's librarian. She would rather you keep to yourself and just quietly browse the books.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What is your profession?_";
	text1 = "_I look after the library of Moon. One of the finest libraries in all of Valorim._";

begintalknode;
	state = 2;
	nextstate = -1;
	question = "_Why is such a big library in such a small town?_";
	text1 = "_Orders from Blackcrag Fortress. Once, we were to store designated Empire resources until the Emperor could designate a final, official library. Then he was killed and we were forgotten._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Where is the library?_";
	text1 = "She points at the northern doors. _Through there is one of the greatest magical libraries in Valorim. Certain authorized persons can enter._";

begintalknode;
	state = 3;
	nextstate = 4;
	condition = gf(171,9) == 0;
	question = "_How do you become an authorized person?_";
	text1 = "_People become authorized by paying a fee, which is used to obtain new tomes and maintain the ones we already have. If you wish to obtain access, it is only three thousand coins._";

begintalknode;
	state = 4;
	nextstate = -1;
	condition = gf(171,9) == 0;
	question = "_I'd like to obtain access to your library._ (Pay 3000 coins.)";
	code =
		run_hardcode(168);
	break;

begintalknode;
	state = 4;
	nextstate = -1;
	condition = gf(171,9) == 0;
	question = "_I don't want to pay that much._";
	text1 = "_Then don't. Our research tools are incredibly valuable, and very expensive to maintain. If you don't have any more business with me, good day._";
	action = END_TALK;

begintalknode;
	state = 1;
	nextstate = 5;
	question = "_Is it tough being a librarian in these harsh times?_";
	text1 = "_What do you think? All I want is to accumulate books and share them. Now I can't get them, and I am sure what I do have will be destroyed._";

begintalknode;
	state = 5;
	nextstate = -1;
	question = "_What is going to destroy the books?_";
	text1 = "_Have you heard nothing of what is happening? Nothing of the monsters, the plagues, the raids, the death?_";

begintalknode;
	state = 5;
	nextstate = 6;
	condition = gf(171,11) <= 1;
	question = "_Why can't you get more books?_";
	text1 = "_Because Valorim was sealed off. Nothing gets through. I even had a valuable tome on the way. The Grimoire of Thren. It was stopped at Blackcrag Fortress. I'm sure of it. Anyway, it never arrived._";
	text2 = "She looks at you, realizing that you travel a lot. _I want that book. I need it. I would pay well for it._";
	action = SET_SDF 171 11 1;
	code =
		toggle_quest(83,1);
	break;
	
begintalknode;
	state = 6;
	nextstate = -1;
	question = "_What do you need it for?_";
	text1 = "_My private research is none of your concern._";
	
begintalknode;
	state = 6;
	nextstate = -1;
	question = "_How do I get into Blackcrag Fortress?_";
	text1 = "_Oh. You don't. It's sealed. That's why I can't get my book._";
	text2 = "_I've heard there is a smuggler's tunnel near the fortress. I won't go there. Smugglers are dangerous. I should have sent the book through there._";
	
begintalknode;
	state = 1;
	nextstate = 7;
	condition = gf(171,11) == 1 && has_spec_item(55) > 0;
	question = "_I have found the Grimoire of Thren._";
	text1 = "She sits up, alert. _Yes! The tome! Give it to me!_";

begintalknode;
	state = 7;
	nextstate = -1;
	condition = gf(171,11) == 1;
	question = "_All right. Here it is._ (Give it to her.)";
	code =
		run_hardcode(49);
	break;

begintalknode;
	state = 7;
	nextstate = -1;
	condition = gf(171,11) == 1;
	question = "_First, payment. Then I give you the book._";
	code =
		run_hardcode(50);
	break;

begintalknode;
	state = 7;
	nextstate = 1;
	condition = gf(171,11) == 1;
	question = "_No, I would rather keep it for now._";
	text1 = "She sits back down, furious. _Do not taunt me. I will not beg, not even for the Grimoire._";
	action = END_TALK;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(171,11) >= 2;
	question = "_What are you going to do with that tome?_";
	text1 = "_Nothing! Just study. Now go. Don't waste my time!_";
	action = END_TALK;

// Lumok

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Lumok";
	text1 = "The innkeeper is very nervous. She washes the counter quickly, always watching the door. _I am Lumok. Welcome to my inn._ Her voice is high-pitched and uneven.";
	text5 = "Lumok is still very nervous. She washes the counter quickly, always watching the door. ";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_What can I get at this inn?_";
	text1 = "_We have a free room for only 10 coins. We have beer for 5 and our specialty, bourbon, for 15._";

begintalknode;
	state = 29;
	nextstate = -1;
	condition = coins_amount() >= 10;
	question = "_Let me get a room._ Pay 10 coins.";
	text1 = "She quickly and wordlessly takes you to your room. You sleep comfortably.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-10);
		relocate_char(get_pc_id(0),26,42,FALSE);
		relocate_char(get_pc_id(1),27,42,FALSE);
		relocate_char(get_pc_id(2),27,43,FALSE);
		relocate_char(get_pc_id(3),26,43,FALSE);
	break;

begintalknode;
	state = 29;
	nextstate = -1;
	condition = coins_amount() >= 5;
	question = "_A round of beer, please._ Pay 5 coins.";
	text1 = "The beer is bitter and watery. Not good at all. Lumok says, _You should try the bourbon. It's much better._";
	code =
		force_char_status(30000,1,20);
		change_coins(-5);
	break;

begintalknode;
	state = 29;
	nextstate = 31;
	condition = coins_amount() >= 15;
	question = "_Some bourbon, please._ Pay 15 coins.";
	text1 = "The bourbon is strong and excellent. As you sip, Lumok says, _Would you like some advice, friends?_";
	code =
		force_char_status(30000,1,20);
		force_char_status(30000,3,20);
		force_char_status(30000,5,20);
		change_coins(-15);
	break;

begintalknode;
	state = 31;
	nextstate = 32;
	question = "_Sure. Any advice is welcome._";
	text1 = "_If you're heading north, forget it. People aren't supposed to speak of it, but Valorim has been quarantined. Blackcrag Fortress is closed off._";

begintalknode;
	state = 32;
	nextstate = -1;
	question = "_Why has Valorim been quarantined?_";
	text1 = "_The Empire is scared of the monsters, and so they have left us to our fate. And that is that._";

begintalknode;
	state = 32;
	nextstate = 33;
	question = "_What is Blackcrag Fortress?_";
	text1 = "_Our greatest fortress. It is taken from us. Now we cannot go there. The Empire is too scared of the alien beasts._";

begintalknode;
	state = 33;
	nextstate = 34;
	question = "_Do you know anything about the alien beasts?_";
	text1 = "She looks visibly upset. _The destroyers of the Keep of Tinraya! I will not speak of it. Want to know more? Go to Dorngas._";

begintalknode;
	state = 34;
	nextstate = -1;
	question = "_Ok. Where is Dorngas?_";
	text1 = "_Southwest. Good day to you._ She moves away quickly.";
	action = END_TALK;

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Nothing, thanks._";
	text1 = "_All right. Good day._ She moves away quickly.";
	action = END_TALK;

begintalknode;
	state = 29;
	nextstate = 35;
	condition = gf(173,11) == 0;
	question = "_Anything interesting happen in town lately?_";
	text1 = "_Well, there was this fellow Zang. He came to town recently. He's some sort of traveling monk or teacher or something. He comes and goes. When he's here, he squats in one of the abandoned homes._";

begintalknode;
	state = 35;
	nextstate = -1;
	question = "_Any idea where I might find him?_";
	text1 = "_Not a clue. He told me he would be around, and that anyone who wanted to learn must be prepared to seek, or some nonsense like that._";
	text2 = "_Standard monk gibberish._";

